#pragma once
#include <QtGui/QWidget>
#include <Qt>
#include <QMouseEvent>

#include <vtkRenderWindow.h>
#include <vtkPolyData.h>
#include <vtkRenderer.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkInteractorStyleTrackballCamera.h>
#include <vtkCamera.h>
#include <vtkSmartPointer.h>
#include <vtkFloatArray.h>
#include <vtkHedgeHog.h>
#include <vtkPointData.h>

#include "fdecl.h"

class VTKWidget : public QWidget{
	Q_OBJECT

public:
	VTKWidget(QWidget *parent = 0);
	~VTKWidget();
	void setSize(int width, int height);
	
	vtkCamera* getActiveCamera();
	void renderModel(const char * args);

	void initHybroid(hybroid* h, int R, int G, int B);
	void renderHybroid(hybroid* h, int R, int G, int B);

	void initRangeData(hybroid* h, int R, int G, int B);
	void renderRangeData(hybroid* h, int R, int G, int B);
	//
	void initForce(hybroid* h, int R, int G, int B);
	void renderForces(hybroid* h, int R, int G, int B);

	void testClip();
protected:
	void mouseReleaseEvent ( QMouseEvent * event ) ;

public slots:
		void onFrontbutton();//to view the front side of the face
		void onBackbutton();//view the back side
		void onLeftbutton();//view the left side
		void onRightbutton();//view the right side
		void onTopbutton();// view the top side
		void onBottombutton();// view the bottom side
		void wireOnOff();
		

signals:

			void setWire(bool on);
			void resetCamera();

public:
	vtkSmartPointer<vtkRenderWindow> m_renWin;

protected:
	void resizeEvent ( QResizeEvent * event );
	void mouseMoveEvent(QMouseEvent * event);
	
	vtkSmartPointer<vtkPolyData> m_data_hybroid;
	vtkSmartPointer<vtkPolyData> m_range_data;
	
	vtkSmartPointer<vtkActor> m_actor;
	vtkSmartPointer<vtkActor> f_actor;
	vtkSmartPointer<vtkRenderer> m_ren1;

	vtkSmartPointer<vtkRenderWindowInteractor> m_iren;
	vtkSmartPointer<vtkInteractorStyleTrackballCamera> m_style;

	bool isWire;

};



